<?php
defined('IN_TS') or die('Access Denied.');
//课程类型

switch($ts){


	//类型列表 
	case "list":
		
		$arrType = $new['study']->findAll('study_type');
		
		include template("admin/type_list");
		
		break;
	
	//类型添加
	case "add":

		

		include template("admin/type_add");
		
		break;
		
	case "adddo":

		$typename = trim($_POST['typename']);
		
		$new['study']->create('study_type',array(
			'typename'=>$typename,
		));
		
		header("Location: ".SITE_URL."index.php?app=study&ac=admin&mg=type&ts=list");
		break;
	
	//删除
	case "del":
		

		$typeid = $_GET['typeid'];
		
		$new['study']->update('study',array(
			'typeid'=>$typeid,
		),array(
		
			'typeid'=>'0',
		
		));
		
		qiMsg("删除成功！");
		
		break;
	
	//修改
	case "edit":

		$typeid = $_GET['typeid'];
		
		$strType = $new['study']->find('study_type');
		
		include template("admin/type_edit");
		
		break;
	
	//修改执行 
	case "editdo":

		$typeid = $_POST['typeid'];
		$typename = trim($_POST['typename']);
		
		$new['study']->update('study_type',array(
			'typeid'=>$typeid,
		),array(
		
			'typename'=>$typename,
		
		));
	
		header("Location: ".SITE_URL."index.php?app=study&ac=admin&mg=type&ts=list");
		
		break;
}